package com.pz.cloud.framework.glory.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pz.cloud.framework.base.dao.CommonDao;
import com.pz.cloud.framework.base.service.BaseServiceImpl;
import com.pz.cloud.framework.business.glory.entity.Glory;
import com.pz.cloud.framework.business.glory.service.IGloryService;
import com.pz.cloud.framework.glory.mapper.GloryMapper;
import com.pz.cloud.framework.model.SqlBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class GloryServiceImpl extends BaseServiceImpl<GloryMapper, Glory> implements IGloryService {
    @Autowired
    private CommonDao commonDao;

    @Override
    public IPage<Glory> findPage(Glory entity) {
        SqlBuilder sqlBuilder = SqlBuilder.init(entity, null);
        IPage page = commonDao.findPage(sqlBuilder);
        return page;
    }

    @Override
    public Glory findByCode(String code) {
        Glory entity = new Glory();
        entity.setCode(code);
        SqlBuilder sqlBuilder = SqlBuilder.init(entity, "g");
        return commonDao.findOne(sqlBuilder);
    }
}
